@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
    </style>
@endsection
@include('Home.User.Common._meta')
<!----  新增： 所有客户  ---->
<div class="modal-content" id="addNew-content2">
    <div class="layui-form modal-second-info" action="">
        <div class="layui-form-item all-client">
            <div class="selector-title">推荐跟进记录表</div>
            <table class="all-client-table">
                <thead>
                <tr>
                    <th>跟进时间</th>
                    <th>沟通记录</th>
                    <th>预计入职时间</th>
                    <th>试用期薪资</th>
                    <th>转正薪资</th>
                    <th>团队</th>
                    <th>跟进人</th>
                    <th>跟进结果</th>
                </tr>
                </thead>
                <tbody>
                @foreach($obj->all_schedule as $v)
                    <tr>
                        <td data-label="跟进时间">{{$v->created_at}}</td>
                        <td data-label="沟通记录">{{$v->content}}</td>
                        <td data-label="预计入职时间">{{$v->result>=10?date('Y-m-d',strtotime($v->plan_time)):''}}</td>
                        <td data-label="试用期薪资">{{$v->result>=10?$v->try_wage:''}}</td>
                        <td data-label="转正薪资">{{$v->result>=10?$v->wage:''}}</td>
                        <td data-label="团队">{{$v->team_name}}</td>
                        <td data-label="跟进人">{{$v->user_name}}</td>
                        <td data-label="跟进结果">{{$v->schedule_result}}</td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    {{--超级管理员  ||  创建者  ||  归属者--}}
    @if($obj->position->permission)
        <form class="layui-form modal-client-info modal-second-info" action="" id="form-user" lay-filter="form-user">
            <div class="modal-func-btns">
                <a href="javascript:;" class="modal-save-btn" onclick="subForm('{{route('add_position_schedule',$obj->id)}}')" title="保存"><i class="icon icon-save"></i></a>

                <a href="javascript:location.replace(location.href);" class="modal-edit-btn" title="重置"><i class="icon icon-edit"></i></a>
            </div>
            @include('Home.User.Common._msg')
            <div class="selector-title" style="margin-bottom: 15px;">新增简历记录</div>
            <div class="layui-form-item create_item">
                <label class="layui-form-label"><span class="red">*</span>预计入职时间</label>
                <div class="layui-input-block">
                    <input type="text" id="plan_time" name="plan_time" autocomplete="off" placeholder="填写预计入职时间" class="layui-input fs12">
                </div>
            </div>
            <div class="layui-form-item create_item">
                <label class="layui-form-label"><span class="red">*</span>试用期薪资</label>
                <div class="layui-input-block">
                    <input type="text" name="try_wage" lay-verify="try_wage" autocomplete="off" placeholder="填写试用期薪资" class="layui-input fs12">
                </div>
            </div>
            <div class="layui-form-item create_item">
                <label class="layui-form-label"><span class="red">*</span>转正薪资</label>
                <div class="layui-input-block">
                    <input type="text" name="wage" lay-verify="wage" autocomplete="off" placeholder="填写转正薪资" class="layui-input fs12">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">跟进结果</label>
                <div class="layui-input-block">
                    <select name="result" lay-filter="result">
                        <option value="1" @if($obj->one_schedule && $obj->one_schedule->result == 1) selected @endif>待推荐</option>
                        <option value="2" @if($obj->one_schedule && $obj->one_schedule->result == 2) selected @endif>已推荐</option>
                        <option value="3" @if($obj->one_schedule && $obj->one_schedule->result == 3) selected @endif>筛选通过</option>
                        <option value="4" @if($obj->one_schedule && $obj->one_schedule->result == 4) selected @endif>安排一面</option>
                        <option value="5" @if($obj->one_schedule && $obj->one_schedule->result == 5) selected @endif>一面fail</option>
                        <option value="6" @if($obj->one_schedule && $obj->one_schedule->result == 6) selected @endif>安排二面</option>
                        <option value="7" @if($obj->one_schedule && $obj->one_schedule->result == 7) selected @endif>二面fail</option>
                        <option value="8" @if($obj->one_schedule && $obj->one_schedule->result == 8) selected @endif>面试通过</option>
                        <option value="9" @if($obj->one_schedule && $obj->one_schedule->result == 9) selected @endif>offer中</option>
                        <option value="10" @if($obj->one_schedule && $obj->one_schedule->result == 10) selected @endif>接offer</option>
                        <option value="11" @if($obj->one_schedule && $obj->one_schedule->result == 11) selected @endif>拒offer</option>
                        <option value="12" @if($obj->one_schedule && $obj->one_schedule->result == 12) selected @endif>待入职</option>
                        <option value="13" @if($obj->one_schedule && $obj->one_schedule->result == 13) selected @endif>已入职</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">沟通记录</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" name="content" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="red">*</span>指定任务归属于</label>
                <div class="layui-input-block">
                    <label for="shareTo">
                        <input type="radio" lay-filter="shareTo" id="shareTo1" name="shareTo" value="1" title="私有" @if($obj->position->shareTo == 1) checked @endif>
                    </label>
                    <label for="shareTo">
                        <input type="radio" lay-filter="shareTo" id="shareTo2" name="shareTo" value="2"  title="共享全员" @if($obj->position->shareTo == 2) checked @endif>
                    </label>
                    <label for="shareTo" class="no-margin">
                        <input type="radio" lay-filter="shareTo" id="shareTo3" name="shareTo" title="指派给" value="3" @if($obj->position->shareTo == 3) checked @endif>
                        <div class="layui-inline">
                            <div class="layui-input-inline" style="width: 160px;">
                                <select lay-filter="assign" id="assign" name="assign">
                                    <option value="0" disabled @if($obj->position->share || $obj->position->shareTo == 1 || $obj->position->shareTo == 2) selected @endif>请选择</option>
                                    @foreach($frame as $item)
                                        @foreach($item as $leader)
                                            <optgroup label="{{$leader->user->username}}">
                                                <option value="{{$leader->uid}}" @if($obj->position->assign == $leader->uid) selected @endif>{{$leader->user->username}}</option>
                                                @foreach($leader->member as $v)
                                                    <option value="{{$v->uid}}" @if($obj->position->assign == $v->uid) selected @endif>{{$v->user->username}}</option>
                                                @endforeach
                                            </optgroup>
                                        @endforeach
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </label>
                </div>
            </div>
        </form>
    @endif

</div>
@section('footer')
    @include('Home.User.Common._assign')
    <script>
        var obj = @JSON($obj);
        if (!obj.one_schedule || obj.one_schedule.result < 10){
            $(".create_item").hide();
        }

        layui.use(['form','laydate'], function(){
            var form = layui.form;
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#plan_time', //指定元素
                type: 'date'
            });

            form.on('select(result)', function(data){
                if (data.value < 10) {
                    $(".create_item").hide();
                }else {
                    $(".create_item").show();
                }
            });
        });
    </script>
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')